﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;

namespace Model.EF
{
    public class NerDinnersInitializer : DropCreateDatabaseIfModelChanges<NerdDinners>
    {
        protected override void Seed(NerdDinners context)
        {
            var dinners = new List<Dinner>
            {
                new Dinner{Title="test1",
                            EventDate=DateTime.Parse("12/31/2011"),
                            Address="testaddress",
                            country="china",
                            HostedBy="111@a.com"                           
                },
                new Dinner{Title="test2",
                            EventDate=DateTime.Parse("12/30/2011"),
                            Address="testaddress",
                            country="china",
                            HostedBy="111@a.com"                           
                }
            };
            dinners.ForEach(d=>context.Dinners.Add(d));
            var sysuser = new List<SystemUser>
            {
                new SystemUser{
                    LoginName="admin",
                    PassWord="admin",
                    RealName="admin",
                    Position="admin",
                    Phone="3",
                    Telephone="12",
                    CreateDate=DateTime.Parse("12/30/2011"),
                    IsUse=true,
                    dock="top",
                    wallpapertype="lashen",
                    wallpaperid=7,
                    appxy="x",
                    dockappid ="1",
                    desk1appid="1,11,2,4,14,15",
                    desk2appid="2,3"
                }
            };
            sysuser.ForEach(x => context.SystemUser.Add(x));
            var sysmenu =new List<SystemMenu>{
                new SystemMenu{
                    MenuName="系统设置",
                    PMenuID=0,
                    FileName="#",
                    FileFolder="#",
                    OrderBy=0,
                    IsVisible=true,
                    Flag="1",
                    Level=0
                },
                new SystemMenu{
                    MenuName="菜单管理",
                    PMenuID=1,
                    FileName="MenuList.aspx",
                    FileFolder="Menu",
                    OrderBy=0,
                    IsVisible=true,
                    Flag="1",
                    Level=1
                },
                new SystemMenu{
                    MenuName="角色管理",
                    PMenuID=1,
                    FileName="Role.aspx",
                    FileFolder="Role",
                    OrderBy=0,
                    IsVisible=true,
                    Flag="1",
                    Level=1
                }
            };
            sysmenu.ForEach(x=>context.SystemMenu.Add(x));
            var systemrole = new List<SystemRole>
            {
                new SystemRole{
                    RoleName="系统管理员",
                    IsUse=true
                },
                new SystemRole{
                    RoleName="总经理",
                    IsUse=true
                }
            };
            systemrole.ForEach(x => context.SystemRole.Add(x));
            var systemrolemenu = new List<SystemRoleMenu>
            {
                new SystemRoleMenu{
                    SystemRoleID=1,
                    SystemMenuID=1,
                    Query=false,
                    Add=false,
                    Update=false,
                    Del=false
                }
            };
            systemrolemenu.ForEach(x=>context.SystemRoleMenu.Add(x));
            var action = new List<ActionTb>
            {
                new ActionTb{
                    AcitonName="浏览",
                    AcitonTag="BROWSE",
                    ActionDescription="页面访问权限",
                    OrderBy=1
                },
                new ActionTb{
                    AcitonName="新增",
                    AcitonTag="ADD",
                    ActionDescription="页面中的添加操作权限",
                    OrderBy=2
                },
                new ActionTb{
                    AcitonName="编辑",
                    AcitonTag="EDIT",
                    ActionDescription="页面中的编辑修改操作权限",
                    OrderBy=3
                },
                new ActionTb{
                    AcitonName="删除",
                    AcitonTag="DELETE",
                    ActionDescription="页面中的删除操作权限",
                    OrderBy=4
                }
            };
            action.ForEach(x => context.ActionTb.Add(x));

            var wallpaper = new List<wallpaper> { 
                new wallpaper{
                title="壁纸1",
                url="img/wallpaper/wallpaper1.jpg",
                width=1920,
                height=1080
            },new wallpaper{
                title="壁纸2",
                url="img/wallpaper/wallpaper2.jpg",
                width=1920,
                height=1080
            },new wallpaper{
                title="壁纸3",
                url="img/wallpaper/wallpaper3.jpg",
                width=1920,
                height=1080
            },new wallpaper{
                title="壁纸4",
                url="img/wallpaper/wallpaper4.jpg",
                width=1920,
                height=1080
            },new wallpaper{
                title="壁纸5",
                url="img/wallpaper/wallpaper5.jpg",
                width=1920,
                height=1080
            },new wallpaper{
                title="壁纸6",
                url="img/wallpaper/wallpaper6.jpg",
                width=1920,
                height=1080
            },new wallpaper{
                title="壁纸7",
                url="img/wallpaper/wallpaper7.jpg",
                width=1920,
                height=1080
            },new wallpaper{
                title="壁纸8",
                url="img/wallpaper/wallpaper8.jpg",
                width=1920,
                height=1080
            },new wallpaper{
                title="壁纸9",
                url="img/wallpaper/wallpaper9.jpg",
                width=1920,
                height=1080
            }
            };
            wallpaper.ForEach(x => context.wallpaper.Add(x));

            var desk=new List<desk>{
                new desk{Name="第一桌面",OrderBy=0},
                new desk{Name="第二桌面",OrderBy=1},
                new desk{Name="第三桌面",OrderBy=2},
                new desk{Name="第四桌面",OrderBy=3},
                new desk{Name="第五桌面",OrderBy=4}
            };
            desk.ForEach(x=>context.desk.Add(x));
            var apps = new List<app> { 
                new app{name="应用管理",icon="img/shortcut/default/应用管理.png",url="#",type=1,width=800,height=520,isresize=true,issetbar=true,remark="应用管理",isshow=true,OrderBy=1,atype=1},
                new app{name="天气预报",icon="img/shortcut/default/天气预报.png",url="http://tool.114la.com/index.php?ct=live&ac=weather_115app&source=115app",type=1,width=800,height=520,isresize=true,issetbar=true,remark="ffffff",isshow=true,OrderBy=1,atype=1},
                new app{name="豆瓣FM",icon="img/shortcut/default/豆瓣FM.png",url="http://douban.fm/partner/webqq?fromhoorayos",type=1,width=800,height=520,isresize=true,issetbar=true,remark="天气预报",isshow=true,OrderBy=1,atype=1},
                new app{name="动漫大乱斗",icon="img/shortcut/default/动漫大乱斗.gif",url="http://img.3366.com/fileupload/flash/33/12333.swf",type=1,width=800,height=520,isresize=true,issetbar=true,remark="豆瓣",isshow=true,OrderBy=1,atype=1},
                new app{name="拳皇无双",icon="img/shortcut/default/拳皇无双.gif",url="http://www.jpuzi.com/webqq/qh/images/mao.swf",type=1,width=800,height=520,isresize=true,issetbar=true,remark="动漫大乱斗",isshow=true,OrderBy=1,atype=1},
                new app{name="捕鱼达人",icon="img/shortcut/default/捕鱼达人.png",url="http://baidufish.lkgame.com/fish/FishLoader.html",type=1,width=800,height=520,isresize=true,issetbar=true,remark="拳皇无双",isshow=true,OrderBy=1,atype=1},
                new app{name="非诚勿扰",icon="img/shortcut/default/非诚勿扰.png",url="http://v.56.com/API/app/baidu/tv/index.php?mid=6085&canvas_pos=search&custom=1&bd_user=553916098&bd_",type=3,width=800,height=520,isresize=true,issetbar=true,remark="捕鱼达人",isshow=true,OrderBy=1,atype=1},
                new app{name="56随心看",icon="img/shortcut/default/56随心看.png",url="http://huodong.56.com/randplay/",type=1,width=800,height=520,isresize=true,issetbar=true,remark="非诚勿扰",isshow=true,OrderBy=1,atype=1},
                new app{name="英语学习",icon="img/shortcut/default/英语学习.png",url="http://tp230.cn/",type=1,width=800,height=520,isresize=true,issetbar=true,remark="随心看",isshow=true,OrderBy=1,atype=1},
                new app{name="柯南漫画",icon="img/shortcut/default/柯南漫画.png",url="http://www.bengou.com/webqq/single_kn008082002.html",type=1,width=800,height=520,isresize=true,issetbar=true,remark="英语学习",isshow=true,OrderBy=1,atype=1},
                new app{name="火影漫画",icon="img/shortcut/default/火影漫画.png",url="http://www.fanmanhua.com/qq/single/detail/10",type=1,width=800,height=520,isresize=true,issetbar=true,remark="柯南漫画",isshow=true,OrderBy=1,atype=1},
                new app{name="三维地图",icon="img/shortcut/default/三维地图.png",url="http://sz.chachaba.com/api20110914.html",type=1,width=800,height=520,isresize=true,issetbar=true,remark="三维地图",isshow=true,OrderBy=1,atype=1},
                new app{name="美图秀秀",icon="img/shortcut/default/美图秀秀.png",url="http://xiuxiu.web.meitu.com/qq/web/",type=1,width=800,height=520,isresize=true,issetbar=true,remark="美图秀秀",isshow=true,OrderBy=1,atype=1},
                new app{name="网站设置",icon="img/ui/system-gear.png",url="sysapp/websitesetting/index.aspx",type=1,width=900,height=550,isresize=true,issetbar=false,remark="网站设置",isshow=true,OrderBy=1,atype=1},
                new app{name="网站设置",icon="img/shortcut/default/DWZ.png",url="System/index.aspx",type=1,width=900,height=550,isresize=true,issetbar=false,remark="DWZ",isshow=true,OrderBy=1,atype=1}
            };
            apps.ForEach(x => context.app.Add(x));

            var set = new List<setting>
            {
                new setting{
                    title="WebOS",description="WebOS是一套web桌面应用框架，类似于Q+web这类的桌面应用网站。",keywords="WebOS,web桌面,桌面管理系统",window_skin="mac"
                }
            };
            set.ForEach(x=>context.setting.Add(x));
        }
    }
}
